<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>岗位页面</title>
		<link rel="stylesheet" type="text/css" href="../../css/base.css">
		<link rel="stylesheet" type="text/css" href="../css/api.css"/>
		<link rel="stylesheet" href="../../css/mui.min.css">
		<style>
			html, body {
				background: #FFFFFF;
				width: 100%;
				height: 100%;
			}
			ul li {
				list-style-type: none;
				height: 100px;
				width: 100%;
			}
			ul, menu, dir {
				display: block;
				list-style-type: disc;
				-webkit-margin-before: 0em;
				-webkit-margin-after: 0em;
				-webkit-margin-start: 0px;
				-webkit-margin-end: 0px;
				-webkit-padding-start: 0px;
			}
			.list_quar {
				width: 100%;
				height: 100%;
				display: -webkit-box;
				padding-top: 5px;
				padding-bottom: 5px;
				/*overflow: hidden;*/
			}
			.list_left {
				width: 160px;
				height: 100%;
				padding: 10px;
				position: relative;
			}
			.list_left img {
				width: 100%;
				height: 100%;
			}
			.list_right {
				-webkit-box-flex: 1;
				height: 100%;
				padding-left: 3px;
				padding-right: 10px;
				padding-top: 5px;
				padding-bottom: 10px;
				position: relative;
			}
			.list_right_text_bz {
				width: 100%;
				line-height: 16px;
				position: relative;
				height: 48px;
				line-height: 16px;
				overflow: hidden;
				display: block;
				-webkit-margin-before: 0em;
				-webkit-margin-after: 0em;
				-webkit-margin-start: 0px;
				-webkit-margin-end: 0px;
			}
			.word-break {
				word-break: break-all
			}
			.xf_div {
				width: 50px;
				height: 20px;
				position: absolute;
				top: 10px;
				left: 10px;
				background: #18b4ed;
				line-height: 20px;
				text-align: center;
				/* border-radius: 10px; */
				
			}
			.xf_div_huise {
				width: 50px;
				height: 20px;
				position: absolute;
				top: 10px;
				left: 10px;
				background: #B0B0B0;
				line-height: 20px;
				text-align: center;
				/* border-radius: 10px; */
				
			}
			.xf_text {
				color: #FFFFFF;
				font-size: 10px;
			}
			.mask {
				position: absolute;
				top: 0px;
				filter: alpha(opacity=60);
				background-color: #777;
				z-index: 1002;
				left: 0px;
				opacity: 0.5;
				-moz-opacity: 0.5;
			}
			.text_ellipsis {
				overflow: hidden;
				text-overflow: ellipsis;
				/* white-space: pre-wrap; */
				/* display: -webkit-box; */
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
				margin-top: 10px;
			}
			.list_quar:active {
				color: #fff;
				background-color: #ECECEC;
			}
			.img_background-image {
				display: block;
				width: 160px;
				max-width: 160px;
				height: 100%;
				background-image: url(../../image/course_placehoder.png);
				background-size: 160px 100%;
			}
			.mui-table-view-cell > a:not(.mui-btn) .subtitle {
				color: #999999;
				font-size: 12px;
				overflow: hidden;
				white-space: normal;
				text-overflow: ellipsis;
				line-height: 22px;
			}
			.mui-table-view-cell .bottom-content {
				padding-top: 16px;
				/*height: 40px;*/
			}
			.info-span {
				margin-right: 10px;
			}
			.rmb-span {
				color: #f60009;
			}
			.tag-img {
				width: 14px;
				height: 14px;
				margin-right: 2px;
			}
			.cell-btn {
				margin-right: 10px;
			}
			.bottom1 {
				position: absolute;
				bottom: 20px;
				white-space: nowrap;
				margin-bottom: 8px;

			}
			.bottom0 {
				position: absolute;
				bottom: 2px;
				white-space: nowrap;
				margin-bottom: 4px;
			}
			.oldPriceLine{
				background-color: #999999;
				width:36px;
				height:1px;
				position:absolute;
				left:12px;
				top:9px;
			}
		</style>
	</head>
	<body>
		<div id='mian'>
			<ul id="quar_list">
	<!--	<li> <div  class="list_quar" ><div class="list_left"><img  class="img_background-image" src="' + img + '" />ispayhtml</div><div class="list_right"><p class=" text_ellipsis base_title_font base_black_grey "> quar_list[i].quarter </p>
				<span class="info-span mui-ellipsis  bottom0 base_content_font base_grey">
			500000000人报名 </span>
			<span class="info-span mui-ellipsis  bottom0 base_content_font rmb-span " style="left: 60px;">
			￥50 </span>
		
				</p></li><div class="div_divider"></div>-->
			</ul>
			<div id="mask" class="mask"></div>
		</div>
		<div class="noSign" hidden="hidden" id="noData">
			<img src="../../image/icon_img.png" width="60%">
			<p class="font16 top_15 base_dark_grey" >
				暂无数据
			</p>
		</div>
		<div class="loadFailure" hidden="hidden" id="noNet">
			<img src="../../image/icon_img01.png" width="60%">
			<p class="" >
				数据加载失败
			</p>
			<p>
				请检查您的网络
			</p>
			<button type="button"  onclick="loadData(3)"class="mui-btn mui-btn-outlined">
				重新加载
			</button>
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script src="../../script/jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script src="../../script/common.js"></script>
	<script type="text/javascript">
		var quar_list = [];
		var types = "1";
		var quarter_directions = "";
		var quarter_ranks = "";
		var quarter_orders = "";
		var pages = 1;
		var rowse = "10";
		var pagerows = 10;
		var newCount = 0;
		//新请求到的数据条数
		apiready = function() {
		     showProgress();
			setRefreshHeader();
			setPullUpRefresh();
			loadData(3);
			//显示分类
			api.addEventListener({
				name : 'mark_show'
			}, function(ret, err) {
				//coding...
				$("#mask").css("height", $(document).height());
				$("#mask").css("width", $(document).width());
				$("#mask").show();
			});
			//打开蒙层
			$("#mask").click(function() {
				$("#mask").hide();
				api.sendEvent({
					name : 'close_mask'
				});
			});
			//关闭蒙版
			api.addEventListener({
				name : 'mark_close'
			}, function(ret, err) {
				//coding...
				//关闭蒙层
				$("#mask").hide();
			});
			//分类
			api.addEventListener({
				name : 'item_point'
			}, function(ret, err) {
				//           alert(JSON.stringify(ret));
				pages = 1;
				//coding...
				//          	types = $api.getStorage("list_types");
				//				quarter_directions = $api.getStorage("quarter_directions");
				//				quarter_ranks = $api.getStorage("quarter_ranks");
				//				quarter_orders = $api.getStorage("quarter_orders");
				if (ret) {
					//滑动到顶部
					api.pageUp({
						top : true
					}, function(ret, err) {
					});
					var data = ret.value.data;
					var type = ret.value.type;
					if (type == 0) {//类型
						types = data[type].id;
						quarter_directions = "";
						quarter_ranks = '';
						quarter_orders = '';
						$api.setStorage("fx", '');
						$api.setStorage("cj", '');
						$api.setStorage("xl", '');
					} else if (type == 1) {//方向
						quarter_directions = data[type].id;
						quarter_ranks = '';
						quarter_orders = '';
						$api.setStorage("cj", '');
						$api.setStorage("xl", '');
					} else if (type == 2) {//层级
						quarter_ranks = data[type].id;
						quarter_orders = '';
						$api.setStorage("xl", '');
					} else if (type == 3) {//序列
						quarter_orders = data[type].id;
					}
				}
				loadData(3);
			});
			
		};
		//加载数据
		function loadData(load_type) {
			
			var jid = "";
			if ($api.getStorage('changfengtype') == 1) {
				jid = $api.getStorage('cfnetppjxid');
			}
			if ($api.getStorage('changfengtype') == 2) {
				jid = $api.getStorage('cfnetppjid');
			}
			var params = {
				jid : jid,
				uid : $api.getStorage("cfnetppuid"),
				type : types,
				quarter_direction : quarter_directions,
				quarter_rank : quarter_ranks,
				quarter_order : quarter_orders,
				page : pages,
				rows : rowse
			};
			cfnetppPOST(url_getQuarterList, params, true, function(data, status) {
				hideProgress();
				if (load_type == 3) {
					loadData_top_type();
				}
				api.refreshHeaderLoadDone();
				if (status == "success") {
					var codes = data.code;
					if (codes == 200) {
						$('#noNet').hide();
						$('#noData').hide();
						$('#mian').show();
						quar_list = data.data.list;
						multiplePicturesCache({
						picArr : quar_list,//包含图片数组
						picKey : 'img',//图片对应的字段
						 isOriginals : 0
						}, function(imageArr){
						  hideProgress();
						   quar_list =imageArr;
//						      console.log(quar_list);
						   //返回替换图片路径后的数组
						   writelist();
						});

						newCount = data.data.list.length;
						
					} else if (codes == 108) {//暂无数据
						if (pages == 1) {
							$('#mian').hide();
							$('#noData').show();
						} else {
							ShowToast("没有数据了")
						}
					} else {
					}
				} else {
					$('#mian').hide();
					$('#noNet').show();
				}
			});
		}

		function writelist() {
			var list_date = "";
			for (var i = 0; i < quar_list.length; i++) {
				var img = quar_list[i].img;
			
				var isdescribe = quar_list[i].quarter_describe;
				var isopen = '';
				var ispayhtml = '';
				if (isdescribe.length > 0) {
					isopen = 1;
				} else {
					isopen = 0;
					img = "../../image/icon_notopenquarter.png";
//					ispayhtml = ' <div class="xf_div_huise"><p class="xf_text">未开通</p></div>';
				}
				
				//支付
				if (quar_list[i].ispay == 1) {
					ispayhtml = ' <div class="xf_div"><p class="xf_text">已支付</p></div>';
				} else if (quar_list[i].ispay == 0) {
					ispayhtml = ' <div class="xf_div"><p class="xf_text">已报名</p></div>';
				}
				//认证
				if (quar_list[i].status == 3) {
					ispayhtml = ' <div class="xf_div"><p class="xf_text">已认证</p></div>';
				}
				var cheaper = "";
				if (quar_list[i].apply_money == 140) {
					cheaper = '<div class="bottom0" ><span class="base_tag_font base_black_grey" >优惠价格 '+'<span class="base_content_font rmb-span"> ￥'+quar_list[i].apply_money+'</span>'+ '<span class="base_tag_font base_grey" style="margin-left:10px;position:relative;">' + '  ￥280.00 <span class="oldPriceLine" style=""></span>'+'</span></div>';

				}else if (quar_list[i].apply_money == 228) {
					cheaper = '<div class="bottom0" ><span class="base_tag_font base_black_grey" >优惠价格 '+'<span class="base_content_font rmb-span"> ￥'+quar_list[i].apply_money+'</span>'+ '<span class="base_tag_font base_grey" style="margin-left:10px;position:relative;">' + '  ￥380.00 <span class="oldPriceLine" style=""></span>'+'</span></div>';

				}else{
					cheaper = '	<span class=" info-span    bottom0  base_tag_font rmb-span " style="left: 0px;">￥' 
				+ quar_list[i].apply_money + '</span>';

				}
				var list_dates = '<li> <div id="lis' + i + '" class="list_quar" onclick="itemclicl(' + quar_list[i].id + "," + "'" + quar_list[i].quarter + "'" + "," + isopen + ')"><div class="list_left"><img  class="img_background-image" src="' + img + '" onerror="Imgnofind()"/>' + ispayhtml + '</div>' + '<div class="list_right">' + '<p class=" text_ellipsis base_content_font base_black_grey one_line1">' + quar_list[i].quarter + '</p>' 
				+ '<span class="info-span  bottom1 base_tag_font  base_grey">'+
//				<img class="tag-img" src="../../image/icon_ren.png" >' 
				+ quar_list[i].applysums + '人已报名</span>' 
				+ cheaper
				+ '</p></li><div class="div_divider"></div>'
				list_date = list_date + list_dates;
			}
			if (pages == 1) {
				$('#quar_list').html(list_date);
			} else {
				$('#quar_list').append(list_date);
			}
		}

		//下拉刷新
		function setRefreshHeader() {
			api.setRefreshHeaderInfo({
				visible : true,
				bgColor : '#ccc',
				textColor : '#fff',
				textDown : '下拉刷新...',
				textUp : '松开刷新...',
				showTime : true
			}, function(ret, err) {
				pages = 1;
				loadData(1);
			});
		}

		// 上拉加载
		function setPullUpRefresh() {
			api.addEventListener({
				name : 'scrolltobottom'
			}, function(ret, err) {
				if (newCount == pagerows) {
					pages = pages + 1;
					loadData(0);
				}
			});
		}

		//点击事件
		function itemclicl(id, quarter, isopen) {
			if (isopen == '0') {
				ShowToast("此职位暂缓开通，敬请期待");
				return;
			}
			api.openWin({useWKWebView:true,
				name : 'Detaila',
				url : 'Detaila.html',
				pageParam : {
					id : id,
					title : quarter,
					sourceurl:api.pageParam.sourceurl, 
		            sourcetitle:api.pageParam.sourcetitle,
				},
				vScrollBarEnabled : false,
				hScrollBarEnabled : false
			});
			SendBehaviorTrajectoriesNotifi1(1, '岗位列表', '119',api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname,  document.title);
		}

		//分类
		function loadData_top_type() {
			var params = {};
			cfnetppPOST(url_getQuarterClassify, params, true, function(data, status) {
				hideProgress();
				if (status == "success") {
					$api.setStorage("top_type", data);
				} else {
					$api.setStorage("top_type", "null");
				}
			});
		}
	</script>
</html>